#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
#define int long long
void solve()
{
    int n, m, k;
    cin >> n >> m >> k;
    int x = (k + n - 1) / n;
    int left = 1, right = m;
    while (left < right)
    {
        int mid = left + right >> 1;
        if((mid)*(m/(mid+1))+m-((mid+1)*(m/(mid+1)))>=x)
            right = mid;
        else
            left = mid + 1;
    }
    cout << left << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tx;
    cin >> tx;
    while (tx--)
    {
        solve();
    }
    return 0;
}